<template>
    <div class="about">
        <button @click="initTableData">点击查询123</button>
        <div>
            <div v-for="item in tableList" :key="item.id">
                <span>{{item.id}}</span> --
                <span>{{item.username}}</span> --
                <span>{{item.password}}</span> --
            </div>
        </div>
    </div>

</template>

<script>
  import AccountList from "../graphql/accountList.graphql"


  export default {
    name: "About",

    data() {
      return {
        tableList: []
      }
    },
    methods: {
      async initTableData() {
        this.tableList = [];
        this.loading = true;
        const {data, loading} = await this.$apollo.query({
          query: AccountList,
          // 处理每次查询的时候, 不调接口刷新
          fetchPolicy: "no-cache"
        });
        console.log(data, '请求返回数据');
        this.loading = loading;
        this.tableList = data.accountList;
      },
    }
  }
</script>

<style scoped>

</style>
